/** 
 * 2011-10-12 下午06:41:55 
 * SendStreamAction.java 
 * author:sunb 
 */
package com.u6.udp.action;

import java.net.SocketAddress;

import org.jboss.netty.channel.MessageEvent;

import com.lamfire.utils.Bytes;
import com.u6.udp.netty.UdpAction;
import com.u6.udp.netty.UdpMessage;
import com.u6.udp.util.MethodID;
import com.u6.udp.util.UdpContext;

/**
 * @author sunbin
 * 
 */
public class SendStreamAction extends UdpAction {

	@Override
	public void execute(MessageEvent event) {
		UdpMessage message = getMessage();
		long reviceid = message.getReceiveUid();
		
		SocketAddress address =UdpContext.getAddressByUid(reviceid);
		if(address==null){
			System.out.println("not find address");
			return;
		}

		message.setMessageID(MethodID.ServerStream);
		event.getChannel().write(message, address);
		
	}

}
